window.requestAnimFrame = (function() {
	return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame ||
	function() {
		return window.setTimeout(callback, 1000 / 60);
	};
})();

function CheckIntersect(object1, object2, overlap) {
	A1 = object1.x + overlap;
	B1 = object1.x + object1.image.width - overlap;
	C1 = object1.y + overlap;
	D1 = object1.y + object1.image.height - overlap;

	A2 = object2.x + overlap;
	B2 = object2.x + object2.image.width - overlap;
	C2 = object2.y + overlap;
	D2 = object2.y + object2.image.height - overlap;

	if (A1 > B2 || B1 < A2 || C1 > D2 || D1 < C2) return false;
	else return true;
}